﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TecentCOS.ViewModels;

namespace TecentCOS.Extensions
{
    public abstract class BaseHtmlTagEngine

    {

        protected int _CntNumber = 0;

        TagContainer _TopTagContainer;

        string _OutString;

        protected HtmlHelper _htmlHelper;



        public BaseHtmlTagEngine(HtmlHelper htmlHelper)

        {

            _htmlHelper = htmlHelper;

        }

        public abstract void BuildTagContainer(TreeMenuModel item, TagContainer parent);
        public void BuildTreeStruct(TreeMenuModel model)

        {

            _CntNumber = 0;

            try
            {

                // 1.先设置放置根菜单的容器

                _TopTagContainer = new TagContainer(ref _CntNumber, null);



                foreach (TreeMenuModel mi in model.Children)

                {

                    BuildTagContainer(mi, _TopTagContainer);

                }

            }

            catch (Exception)

            {



                throw;

            }

        }
    }
}